﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/common.Master" AutoEventWireup="true" CodeBehind="ShowPost.aspx.cs" Inherits="pcsse.BBS.ShowPost" Title="讨论帖子" ValidateRequest="false"%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style4
        {
            width: 91px;
        }
        .style6
        {
        }
        .style8
        {
            width: 300px;
        }
        .style9
        {
            width: 100px;
        }
    </style>
    <link href="../CSS/bbs.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="hoder_sidebar" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="hoder_maincontent" runat="server">
<div class="p_title">
        <asp:Label ID="Label_sname" runat="server" Text="Label"></asp:Label></div>

    <asp:SiteMapPath ID="SiteMapPath1" runat="server" SkipLinkText="">
    </asp:SiteMapPath>
    <br />
    
    <asp:ListView ID="ListView1" runat="server" DataSourceID="PostDataSource" 
        DataKeyNames="ID">
        <ItemTemplate>
            <tr >
                <td>
                     <asp:LinkButton ID="LinkType" runat="server" Text='<%# Eval("BR_NAME") %>' Font-Bold="True" Font-Underline="True" PostBackUrl='<%# "ShowPost.aspx?ID="+Request["ID"].ToString()+"&BRANCH="+Eval("BR_NAME") %>'/> 
                </td>
                <td>
                    <asp:LinkButton ID="TITLELabel" runat="server" 
                        Text='<%# Eval("TITLE") %>'  PostBackUrl='<%# "Post.aspx?ID="+Eval("ID") %>'/>                      
                </td>
                <td>
                    <asp:Label ID="STUDENT_IDLabel" runat="server" 
                        Text='<%# Eval("STUDENT_ID") %>' />
                </td>
                <td>
                    <asp:Label ID="TIMELabel" runat="server" Text='<%# Eval("TIME") %>' />
                </td>             
            </tr>
        </ItemTemplate>

        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        未返回数据。</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <LayoutTemplate>
           
           <table class="style1">
        <tr>
            <td class="style9">
                支部</td>
            <td class="style8">
                主题</td>
            <td class="style9">
                发帖人</td>
            <td class="style6">
                时间</td>

        </tr>
       
        <tr ID="itemPlaceholder" runat="server" />
        <tr >
                    <td colspan="4" runat="server">
                         <div style="text-align:right">
                        <asp:DataPager ID="DataPager1" QueryStringField="p" runat="server" PageSize="5" PagedControlID="ListView1">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" FirstPageText="首页"  />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" LastPageText="末页" />
                            </Fields>
                        </asp:DataPager>
                        &nbsp;<a href="#" onclick="javascript:history.go(-2)">后退</a>
                        &nbsp;<a href="Subject.aspx" >返回上一级</a>
                        &nbsp;<a href='<%= "ShowPost.aspx?ID="+Request["ID"].ToString() %>' >所有帖子</a>
                        </div>
                    </td>
                </tr>
    </table>
           
           
                            
                          
                

        </LayoutTemplate>

    </asp:ListView>
    <asp:ListView ID="ListView2" runat="server" DataSourceID="PostDataSource" 
        DataKeyNames="ID" Visible="False">
        <ItemTemplate>
            <tr >
                <td>
                    <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="LinkType" runat="server" Text='<%# "【"+Eval("BR_NAME")+"】" %>' Font-Bold="True" Font-Underline="True" PostBackUrl='<%# "ShowPost.aspx?ID="+Request["ID"].ToString()+"&BRANCH="+Eval("BR_NAME") %>'/> 
                    <asp:LinkButton ID="TITLELabel" runat="server" 
                        Text='<%# Eval("TITLE") %>'  PostBackUrl='<%# "Post.aspx?ID="+Eval("ID") %>'/>                      
                </td>
                <td>
                    <asp:Label ID="STUDENT_IDLabel" runat="server" 
                        Text='<%# Eval("STUDENT_ID") %>' />
                </td>
                <td>
                    <asp:Label ID="TIMELabel" runat="server" Text='<%# Eval("TIME") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete">删除</asp:LinkButton>
                </td>
                
            </tr>
        </ItemTemplate>
       
        <EmptyDataTemplate>
            <table id="Table1" runat="server" 
                >
                <tr>
                    <td>
                        未返回数据。</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <tr >
                <td>
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="插入" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="清除" />
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:TextBox ID="TITLETextBox" runat="server" 
                        Text='<%# Bind("TITLE") %>' />
                </td>
                <td>
                    <asp:TextBox ID="STUDENT_IDTextBox" runat="server" 
                        Text='<%# Bind("STUDENT_ID") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TIMETextBox" runat="server" Text='<%# Bind("TIME") %>' />
                </td>
            </tr>
        </InsertItemTemplate>
        <LayoutTemplate>
            <table id="Table2" runat="server">
                <tr id="Tr1" runat="server">
                    <td id="Td1" runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="1" 
                            >
                            <tr id="Tr2" runat="server">
                                <th id="Th1" runat="server">
                                    ID</th>
                                <th id="Th2" runat="server">
                                    主题</th>
                                <th id="Th3" runat="server">
                                    发帖人</th>
                                <th id="Th4" runat="server">
                                    时间</th>
                                <th id="Th5" runat="server">
                                    操作</th>
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr id="Tr3" runat="server">
                    <td id="Td2" runat="server" 
                        >
                         <div style="text-align:right">
                        <asp:DataPager ID="DataPager2" QueryStringField="p" runat="server" PageSize="5" PagedControlID="ListView2">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" FirstPageText="首页"  />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" LastPageText="末页" />
                            </Fields>
                        </asp:DataPager>
                        &nbsp;<a href="Subject.aspx">返回上一级</a>
                        &nbsp;<a href='<%= "ShowPost.aspx?ID="+Request["ID"].ToString() %>' >所有帖子</a>
                        </div>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <EditItemTemplate>
            <tr style="background-color: #FFCC66;color: #000080;">
                <td>
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="更新" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
                </td>
                <td>
                    <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TITLETextBox" runat="server" 
                        Text='<%# Bind("TITLE") %>' />
                </td>
                <td>
                    <asp:TextBox ID="STUDENT_IDTextBox" runat="server" 
                        Text='<%# Bind("STUDENT_ID") %>' />
                </td>
                <td>
                    <asp:TextBox ID="TIMETextBox" runat="server" Text='<%# Bind("TIME") %>' />
                </td>
            </tr>
        </EditItemTemplate>
        <SelectedItemTemplate>
            <tr style="background-color: #FFCC66;font-weight: bold;color: #000080;">
                <td>
                    <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="LinkType" runat="server" Text='<%# "【"+Eval("BR_NAME")+"】" %>' 
                    Font-Bold="True" Font-Underline="True"  PostBackUrl='<%# "ShowPost.aspx?ID="+Request["ID"].ToString()+"&BRANCH="+Eval("BR_NAME") %>'/>
                    <asp:LinkButton ID="TITLELabel" runat="server" 
                        Text='<%# Eval("TITLE") %>' PostBackUrl='<%# "Post.aspx?ID="+Eval("ID") %>'/>
                </td>
                <td>
                    <asp:Label ID="STUDENT_IDLabel" runat="server" 
                        Text='<%# Eval("STUDENT_ID") %>' />
                </td>
                <td>
                    <asp:Label ID="TIMELabel" runat="server" Text='<%# Eval("TIME") %>' />
                </td>
                <td>
                    <asp:LinkButton ID="LinkButton2" runat="server" CommandName="Delete">删除</asp:LinkButton>
                </td>
                
            </tr>
        </SelectedItemTemplate>
    </asp:ListView>
    <asp:SqlDataSource ID="PostDataSource" runat="server" 
        ConnectionString="<%$ ConnectionStrings:PCSSE %>" 
        DataSourceMode="DataSet"
        SelectCommand="SELECT [T_POST].[ID], [TITLE], [STUDENT_ID], [T_POST].[TIME],[BR_NAME] FROM [T_POST],[T_PERSONINFO],[T_PARTY],[T_BRANCH] WHERE ([SUBJECT_ID] = @SUBJECT_ID) AND [T_POST].[STUDENT_ID]
        = [T_PERSONINFO].[NUMBER] AND [T_PARTY].[PERSONID] = [T_PERSONINFO].[ID] AND [T_BRANCH].[ID] = [T_PARTY].[BRANCH_ID] ORDER BY [T_POST].[TIME] DESC"
        FilterExpression="[BR_NAME]='{0}'"
        DeleteCommand="DELETE FROM [T_POST] WHERE [ID]=@ID;DELETE FROM [T_REPLY] WHERE [TITLE_ID]=@ID"
        >
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="SUBJECT_ID" 
                QueryStringField="ID" Type="Int32" />
        </SelectParameters>
        <FilterParameters>
        <asp:QueryStringParameter DefaultValue="" Name="BRANCH_NAME" 
                QueryStringField="BRANCH" />
                </FilterParameters>
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        </asp:SqlDataSource>
        <table align="left">
      <tr>
      <td class="style4">
     <asp:Label ID="Label1" runat="server" Text="标题："></asp:Label>
    </td>
    <td>
     <asp:TextBox ID="TextBox1" runat="server" style="margin-left: 0px" 
        Width="500px"></asp:TextBox>
        </td>
    </tr>
          <caption>
              <br />
              <br />
              <tr>
                  <td class="style4">
                      内容：</td>
                  <td>
                      <textarea id="textcontent" cols="100" rows="8" style="width:500px;height:200px;visibility:hidden;" runat="server"></textarea>
                  </td>
              </tr>
          </caption>
          <tr>
          <td class="style4">
              <asp:Button ID="Button1" runat="server" Text="提交" Height="30px" 
                  onclick="Button1_Click" Width="73px" /><br />(提交快捷键: Ctrl + Enter)</td>
          </tr>
    </table>
    
    <br />
    
    <script type="text/javascript" charset="utf-8" src="../kindeditor/kindeditor.js"></script>

		<script type="text/javascript">

			KE.show({

				id : '<%=textcontent.ClientID %>',

				resizeMode : 1,

				allowPreviewEmoticons : false,

				allowUpload : false,

				items : [

				'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',

				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',

				'insertunorderedlist', '|', 'emoticons', 'image', 'link']

			});

		</script>
</asp:Content>
